'\" te
.\"  Copyright (c) 1998 Sun Microsystems, Inc.  All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH TD_TA_NEW 3C_DB "Oct 20, 1998"
.SH NAME
td_ta_new, td_ta_delete, td_ta_get_ph \- allocate and deallocate process
handles for libc_db
.SH SYNOPSIS
.LP
.nf
cc [ \fIflag\fR... ] \fIfile\fR... -lc_db [ \fIlibrary\fR... ]
#include <proc_service.h>
#include <thread_db.h>

\fBtd_err_e\fR \fBtd_ta_new\fR(\fBconst struct ps_prochandle *\fR\fIph_p\fR, \fBtd_thragent_t **\fR\fIta_pp\fR);
.fi

.LP
.nf
\fBtd_err_e\fR \fBtd_ta_delete\fR(\fBconst td_thragent_t *\fR\fIta_p\fR);
.fi

.LP
.nf
\fBtd_err_e\fR \fBtd_ta_get_ph\fR(\fBconst td_thragent_t *\fR\fIta_p\fR, \fBstruct ps_prochandle **\fR\fIph_pp\fR);
.fi

.SH DESCRIPTION
.sp
.LP
The \fBtd_ta_new()\fR function registers a target process with
\fBlibc_db\fR(3LIB) and allocates an internal process handle of type
\fBtd_thragent_t\fR for this target process.  Subsequent calls to \fBlibc_db\fR
can use this handle to refer to this target process.
.sp
.LP
There are actually two process handles,  an internal process handle assigned by
\fBlibc_db\fR and an external process handle assigned by the \fBlibc_db\fR
client. There is a one-to-one correspondence between the two handles.  When the
client calls a \fBlibc_db\fR function, it uses the internal process handle.
When \fBlibc_db\fR calls one of the client-provided routines listed in
\fBproc_service\fR(3PROC), it uses the external process handle.
.sp
.LP
The \fIph\fR argument is the external process handle that \fBlibc_db\fR should
use to identify this target process to the controlling process when it calls
routines in the imported interface.
.sp
.LP
If this call is successful, the value of the newly allocated
\fBtd_thragent_t\fR handle is returned in  *\fIta_pp\fR. The
\fBtd_ta_delete()\fR function deregisters a target process with \fBlibc_db\fR,
which deallocates its internal process handle and frees any other resources
\fBlibc_db\fR has acquired with respect to the target process. The \fIta_p\fR
argument specifies the target process to be deregistered.
.sp
.LP
The \fBtd_ta_get_ph()\fR function returns in *\fIph_pp\fR the external process
handle that corresponds to the internal process handle \fIta_p\fR. This is
useful for checking internal consistency.
.SH RETURN VALUES
.sp
.ne 2
.na
\fB\fBTD_OK\fR\fR
.ad
.RS 18n
The call completed successfully.
.RE

.sp
.ne 2
.na
\fB\fBTD_BADPH\fR\fR
.ad
.RS 18n
A \fINULL\fR external process handle was passed to \fBtd_ta_new()\fR.
.RE

.sp
.ne 2
.na
\fB\fBTD_ERR\fR\fR
.ad
.RS 18n
The \fIta_pp\fR argument is \fINULL\fR or an internal error occurred.
.RE

.sp
.ne 2
.na
\fB\fBTD_DBERR\fR\fR
.ad
.RS 18n
A call to one of the imported interface routines failed.
.RE

.sp
.ne 2
.na
\fB\fBTD_MALLOC\fR\fR
.ad
.RS 18n
Memory allocation failure.
.RE

.sp
.ne 2
.na
\fB\fBTD_NOLIBTHREAD\fR\fR
.ad
.RS 18n
The target process does not appear to be multithreaded.
.RE

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for description of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
MT-Level	Safe
.TE

.SH SEE ALSO
.sp
.LP
.BR libc_db (3LIB),
.BR proc_service (3PROC),
.BR attributes (7)
